home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Netware Super Library
/
Netware Super Library.iso
/
diagnstc
/
_winfile
/
nr6000
/
netrpt
/
disk1
/
setup.mst
< prev
next >
Wrap
Text File
|
1995-01-10
|
11KB
|
476 lines
'**************************************************************************
' HawkNet Inc. NetTune PRO Setup
'**************************************************************************
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc' ''Detects Avalilable Disk Space
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST APPHELP = 900
CONST RESTART = 1000
CONST CUSTINST = 6200
CONST TOOBIG = 6300
CONST BADPATH = 6400
'' window sizing
CONST WS_VISIBLE = &H10000000
CONST WS_CAPTION = &H00C00000
CONST WS_CLIPCHILDREN = &H02000000
CONST WS_SYSMENU = &H00080000
CONST WS_MINIMIZEBOX = &H00020000
CONST WS_MAXIMIZEBOX = &H00010000
CONST WS_THICKFRAME = &H00040000
CONST GWL_STYLE = -16
CONST SW_SHOWMAXIMIZED = 3
'' File TYPES
CONST OPTFILES1 = 1
CONST OPTFILES2 = 2
''Bitmap ID
CONST INSTALL = 1
'' HawkNet Bitmap
CONST HNLOGO = 2
'' File set symbol names
GLOBAL OPT1NEEDS$
GLOBAL OPT2NEEDS$
GLOBAL EXTRACOSTS$
GLOBAL BIGLIST$
GLOBAL DRIVETEXT$
GLOBAL NTDEST$
GLOBAL WINDRIVE$
GLOBAL GROUP$
GLOBAL ITEM$
GLOBAL ITME2$
GLOBAL ITEM3$
GLOBAL ITEM4$
GLOBAL EXE$
GLOBAL EXE2$
GLOBAL EXE3$
GLOBAL EXE4$
GLOBAL SRCDIR$
GLOBAL WINDIR$
GLOBAL SETUPDIR$
DECLARE SUB AddOptFilesToCopyList (ftype%)
DECLARE SUB RecalcOptFiles (ftype%)
DECLARE SUB RecalcPath
DECLARE SUB SetDriveStatus
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%, iShow%) AS INTEGER
DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
''
'' Initialize window
''
hWnd% = HwndFrame()
k& = SetWindowLong(hWnd%, GWL_STYLE, WS_CAPTION+WS_VISIBLE+WS_CLIPCHILDREN+WS_SYSMENU+WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_THICKFRAME)
j% = ShowWindow(hWnd%, SW_SHOWMAXIMIZED)
''
'' Check Windows Version Number
''
MajorVer% = GetWindowsMajorVersion()
MinorVer% = GetWindowsMinorVersion()
IF MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN
i% = DoMsgBox("Microsoft Windows version 3.10 or greater is required for this software. Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
END IF
''
'' Setup globals
''
SetBitmap CUIDLL$, INSTALL
SetTitle "HawkNet, Inc."
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
END IF
ReadInfFile szInf$
SRCDIR$ = GetSymbolValue("STF_SRCDIR")
WINDIR$ = GetWindowsDir()
WINDRIVE$ = MID$(WINDIR$, 1, 1)
NTDEST$ = WINDRIVE$ + ":\NETRPT"
EXE$ = "NETRPT.EXE"
EXE2$ = "NETRPT.WRI"
EXE3$ = "NETRPT.HLP"
GROUP$ = "HawkNet"
ITEM$ = "NetReport"
ITEM2$ = "NetReport ReadMe"
ITEM3$ = "NetReport Help"
SETUPDIR$ = WINDRIVE$ + ":\~hawknet.t"
'' list symbols
DRIVETEXT$ = "DriveStatusText"
FOR i% = 1 TO 3 STEP 1
AddListItem DRIVETEXT$, ""
NEXT i%
ReplaceListItem DRIVETEXT$, 3, NTDEST$
''Disk cost list symbols
OPT1NEEDS$ = "OptNeeds1"
OPT2NEEDS$ = "OptNeeds2"
EXTRACOSTS$ = "ExtraCosts"
BIGLIST$ = "BigList"
FOR i% = 1 TO 2 STEP 1
AddListItem BIGLIST$, ""
NEXT i%
FOR i% = 1 TO 26 STEP 1
AddListItem EXTRACOSTS$, "0"
NEXT i%
SetRestartDir SETUPDIR$
'' RecalcPath
'' SetDriveStatus
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
RecalcPath
SetDriveStatus
CUSTINST:
sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
''Install only if it will fit.
FOR i% = 1 TO 2 STEP 1
IF GetListItem(BIGLIST$, i%) <> "" THEN
GOSUB TOOBIG
GOTO CUSTINST
END IF
NEXT i%
UIPop 1
GOTO INSTALL
ELSEIF sz$ = "PATH" THEN
GOTO GETPATH
ELSEIF sz$ = "REACTIVATE" THEN
RecalcPath
SetDriveStatus
GOTO CUSTINST
ELSE
GOSUB ASKQUIT
GOTO CUSTINST
END IF
INSTALL:
ClearCopyList
AddOptFilesToCopyList OPTFILES1
AddOptFilesToCopyList OPTFILES2
CreateDir NTDEST$, cmoNone
CopyFilesInCopyList
CreateProgmanGroup GROUP$, "", cmoNone
CreateProgmanItem GROUP$, ITEM$, MakePath(NTDEST$, EXE$),","+","+","+MakePath(NTDEST$,""), cmoOverwrite
CreateProgmanItem GROUP$, ITEM2$, "WRITE.EXE " + MakePath(NTDEST$, EXE2$), "", cmoOverwrite
CreateProgmanItem GROUP$, ITEM3$, "WINHELP.EXE " + MakePath(NTDEST$,EXE3$),"", cmoOverwrite
CreateIniKeyValue "WIN.INI", GROUP$, "NetReportHome", NTDEST$, cmoOverwrite
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
'' HawkNet Bitmap
''SetBitmap CUIDLL$, HNLOGO
n% = RestartListEmpty()
IF n% = 1 THEN
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
'' ELSEIF sz$ = "BACK" THEN
'' chdir NTDEST$
'' Run MakePath(NTDEST$, EXE$), NOWAIT
END IF
ELSE
dlg% = RESTART
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
n% = ExitExecRestart()
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call (619) 929-9966!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
''
'' ASKQUIT
''
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
'' ERROR STFQUIT
END
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
''
'' TOOBIG
''
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
END IF
UIPop 1
RETURN
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
''
'' GETPATH
''
'' Get destination path
''
GETPATH:
SetSymbolValue "EditTextIn", NTDEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
olddest$ = NTDEST$
NTDEST$ = GetSymbolValue("EditTextOut")
''Validate new path.
IF IsDirWritable(NTDEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
''Truncate display if too long.
IF LEN(NTDEST$) > 23 THEN
ReplaceListItem DRIVETEXT$, 3, MID$(NTDEST$, 1, 23)+"..."
ELSE
ReplaceListItem DRIVETEXT$, 3, NTDEST$
END IF
''Recalc if path changed.
IF (olddest$ <> NTDEST$) AND (olddest$ <> NTDEST$+"\") AND (olddest$+"\" <> NTDEST$) THEN
RecalcPath
SetDriveStatus
END IF
olddest$ = ""
GOTO CUSTINST
ELSEIF sz$ = "REACTIVATE" THEN
RecalcPath
SetDriveStatus
GOTO GETPATHL1
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO GETPATHL1
ELSE
UIPop 1
GOTO CUSTINST
END IF
''
'' MakePath
''
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION
''
'' AddOptFilesToCopyList
''
SUB AddOptFilesToCopyList (ftype%) STATIC
IF ftype% = OPTFILES1 THEN
AddSectionFilesToCopyList "NTEXE", SRCDIR$, NTDEST$
ELSEIF ftype% = OPTFILES2 THEN
AddSectionFilesToCopyList "NWDLLS", SRCDIR$, WINDIR$
END IF
END SUB
''
'' RecalcOptFiles
''
SUB RecalcOptFiles (ftype%) STATIC
CursorSave% = ShowWaitCursor()
ClearCopyList
AddOptFilesToCopyList ftype%
fExtra% = 0
IF ftype% = OPTFILES1 THEN
ListSym$ = OPT1NEEDS$
ELSEIF ftype% = OPTFILES2 THEN
ListSym$ = OPT2NEEDS$
END IF
StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
cost& = 0
FOR i% = 1 TO 26 STEP 1
cost& = cost& + VAL(GetListItem(ListSym$, i%))
NEXT i%
IF StillNeed& > 0 THEN
ReplaceListItem BIGLIST$, ftype%, "YES"
ELSE
ReplaceListItem BIGLIST$, ftype%, ""
END IF
IF fExtra% THEN
ReplaceListItem EXTRACOSTS$, ndrive%, "0"
END IF
RestoreCursor CursorSave%
ListSym$ = ""
END SUB
''
'' RecalcPath
''
'' Calculate the amount of disk space need for the installation
''
SUB RecalcPath STATIC
CursorSave% = ShowWaitCursor()
RecalcOptFiles OPTFILES1
RecalcOptFiles OPTFILES2
RestoreCursor CursorSave%
END SUB
''
'' SetDriveStatus
''
'' Determine the amount of available space and the amount needed for
'' this installation.
''
SUB SetDriveStatus STATIC
drive$ = MID$(NTDEST$, 1, 1)
ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
cost& = VAL(GetListItem(OPT1NEEDS$,ndrive%))+VAL(GetListItem(OPT2NEEDS$,ndrive%))
free& = GetFreeSpaceForDrive(drive$)
ReplaceListItem DRIVETEXT$, 1, STR$(cost& / 1024) + " K"
ReplaceListItem DRIVETEXT$, 2, STR$(free& / 1024) + " K"
ReplaceListItem DRIVETEXT$, 3, NTDEST$
END SUB